const vk = uni.vk;

type vkConfig = {
	title?: string,
	loading?: boolean,
	needAlert?: boolean
}

import * as nineth from "@/common/protocol/nineth"

function Request(url: string, params: Object = {}, vConfig: vkConfig = { title: "" }): Promise<nineth.Result>{
			
	return new Promise(function(resolve, reject){
		
		vk.callFunction({
			url,
			...vConfig,
			data: params,
		}).then((e: nineth.Result) => {
			resolve(e)	
		}).catch((e: nineth.ResultError) => {
			reject(e);
		});
		
	});
	
}
		

// 获取当前设备信息
export function getUdeviceInfo(): Promise<nineth.ResultInfo>{
	
	return Request( "client/pub/uDevice.getInfo");
	
}	